
* define path to the folder
global path "/Users/francescocolombo/Dropbox/papers/memory and political attitudes/paper/code/replication_file"

set scheme plotplain 
graph set window fontface "Times New Roman"

*************** Figure 2 ***************
use "$path/data_final.dta", replace

sum aut_nostalgia, d
local media=r(mean)
local mediana=r(p50)
histogram aut_nostalgia, ///
	bin(50) ///
	color(gs8%40) ///
	percent ///
	xline(`media', ///
		lcolor(red%60)) ///
	xline(`mediana', ///
		lcolor(blue%60)) ///
	xline(50, lcolor(grey) lstyle(foreground)) ///
	name(hist, replace) ///
	ytitle(, size(mlarge)) ///	
	xtitle(, size(mlarge)) ///
	aspect(.3)
		
graph export "$path/figures/figure2.pdf", replace 

*************** Figure 3 ***************

foreach x of varlist fascist_memory support_mussolini keep_commemorating sup_trns_jstc_fasc1 af_outdated af_founding party_ban anti_fascist {
	preserve
		collapse (mean) mean= `x' (sd) sd=`x' (count) n=`x'

		generate hi = mean + invttail(n-1,0.025)*(sd / sqrt(n))
		generate low = mean - invttail(n-1,0.025)*(sd / sqrt(n))
		gen var="`x'"
		save "$path/temp/mean_`x'_dat", replace
	restore
}

preserve

	use "$path/temp/mean_af_outdated_dat", replace
	
	foreach x in fascist_memory support_mussolini keep_commemorating sup_trns_jstc_fasc1 af_founding party_ban anti_fascist {

		append using "$path/temp/mean_`x'_dat"
	}

	replace var="G. Partisan are traitors" if var=="fascist_memory" 
	replace var="F. Mussolini great leader" if var=="support_mussolini" 
	replace var="D. Support commemoration" if var=="keep_commemorating" 
	replace var="E. Punish fascists" if var=="sup_trns_jstc_fasc1" 
	replace var="H. Anti-fascism is outdated" if var=="af_outdated" 
	replace var="B. Anti-fascism founding value" if var=="af_founding" 
	replace var="C. Ban neo-fascist parties" if var=="party_ban" 
	replace var="A. Identify as anti-fascist" if var=="anti_fascist" 
	
	
	
	gen positive=1
	replace positive=0 if var=="H. Anti-fascism is outdated"
	replace positive=0 if var=="F. Mussolini great leader"
	replace positive=0 if var=="G. Partisan are traitors"
	
	replace mean=mean*100
	replace hi=hi*100
	replace low=lo*100
	
	encode var, gen(variables)
	
	twoway ///
		(bar mean variables, ///
			barwidth(0.8) horizontal ///
			color(gs8%40)) /// 
		(rspike hi low variables, horizontal yline(5.5, lcolor(black))) ///
			, legend(off) ///
			ytitle("", size(mlarge)) ///	
			xlabel(0(10)100, grid glcolor(black%70) glw(medium) labs(medl)) ///
			ylabel(1(1)8, valuelabel grid glcolor(black%70) glw(medium) labs(medl)) ///
			xtitle("Share of support", size(medl)) ///
			xline(50, lcolor(red)) ///
			title("") ///
			name(bar, replace) ///
			aspect(.3)

			
	graph export "$path/figures/figure3.pdf", replace


restore

*************** Figure 4 ***************

frames reset
use "$path/data_final.dta", replace

frame create output t b se ub95 lb95 ub90 lb90

* Post-commemoration treatment
reg aut_nostalgia i.post_commemoration, vce(robust)
local df=e(df_r)
margins, dydx(post_commemoration) post coeflegend


frame post output (4) (_b[1.post_commemoration]) (_se[1.post_commemoration]) (_b[1.post_commemoration]-invttail(`df', .975)*_se[1.post_commemoration]) (_b[1.post_commemoration]+invttail(`df', .975)*_se[1.post_commemoration]) (_b[1.post_commemoration]-invttail(`df', .95)*_se[1.post_commemoration]) (_b[1.post_commemoration]+invttail(`df', .95)*_se[1.post_commemoration])

* public treatment

reg aut_nostalgia i.treatment_public, vce(robust)
local df=e(df_r)
margins, dydx(treatment_public) post coeflegend

frame post output (3) (_b[1.treatment_public]) (_se[1.treatment_public]) (_b[1.treatment_public]-invttail(`df', .975)*_se[1.treatment_public]) (_b[1.treatment_public]+invttail(`df', .975)*_se[1.treatment_public]) (_b[1.treatment_public]-invttail(`df', .95)*_se[1.treatment_public]) (_b[1.treatment_public]+invttail(`df', .95)*_se[1.treatment_public])

* Interaction effect
gen inter=post_commemoration
replace inter=1 if post_commemoration==0 & treatment_public==1
replace inter=2 if post_commemoration==1 & treatment_public==0
replace inter=3 if post_commemoration==1 & treatment_public==1

reg aut_nostalgia i.inter, vce(robust)
local df=e(df_r)

frame post output (2) (_b[1.inter]) (_se[1.inter]) (_b[1.inter]-invttail(`df', .975)*_se[1.inter]) (_b[1.inter]+invttail(`df', .975)*_se[1.inter]) (_b[1.inter]-invttail(`df', .95)*_se[1.inter]) (_b[1.inter]+invttail(`df', .95)*_se[1.inter])

frame post output (1) (_b[2.inter]) (_se[2.inter]) (_b[2.inter]-invttail(`df', .975)*_se[2.inter]) (_b[2.inter]+invttail(`df', .975)*_se[2.inter]) (_b[2.inter]-invttail(`df', .95)*_se[2.inter]) (_b[2.inter]+invttail(`df', .95)*_se[2.inter])

frame post output (0) (_b[3.inter]) (_se[3.inter]) (_b[3.inter]-invttail(`df', .975)*_se[3.inter]) (_b[3.inter]+invttail(`df', .975)*_se[3.inter]) (_b[3.inter]-invttail(`df', .95)*_se[3.inter]) (_b[3.inter]+invttail(`df', .95)*_se[3.inter])

* Effects plot

frame change output

label define t_lbl 4 "Post-commemoration" 3 "Public treatment" 2 "Public - Pre-commemoration" 1 "Private - Post-commemoration"  0 "Public - Post-commemoration"
label values t t_lbl

twoway ///
	scatter t b if t>2, ///
		mc(black) ///
		msymbol(o) ///
	|| ///
	rspike lb90 ub90 t if t>2, ///
		horizontal ///
		lc(black) ///
		lw(medium) ///
	|| ///
	rspike lb95 ub95 t if t>2, ///
		horizontal ///
		lc(black) ///
		lw(thin) ///
	|| ///
		, ///
		legend(off) ///	
		graphregion(margin(16.85 3.2 0 0)) ///
		ytitle("", size(mlarge)) ///	
		ylabel(3(1)4, valuelabel nogrid labs(medl)) ///
		yscale(range(2.5 4.5)) ///
		xlabel(-8(4)8, grid glcolor(black%70) glw(medium) labs(medl)) ///
		xscale(off) ///
		xtitle("", size(medl)) ///
		xline(0, lcolor(red) lstyle(foreground)) ///
		title("Individual treatment models", box fcolor(gs14) bexpand size(medlarge)) ///
		name(ind, replace) ///
		fysize(50) 
		
twoway ///
	scatter t b if t<=2, ///
		mc(black) ///
		msymbol(o) ///
	|| ///
	rspike lb90 ub90 t if t<=2, ///
		horizontal ///
		lc(black) ///
		lw(medium) ///
	|| ///
	rspike lb95 ub95 t if t<=2, ///
		horizontal ///
		lc(black) ///
		lw(thin) ///
	|| ///
		, ///
		legend(off) ///		
		ytitle("", size(mlarge)) ///	
		ylabel(0(1)2, valuelabel nogrid labs(medl)) ///
		yscale(range(-.5 2.5)) ///
		xlabel(-8(4)8, grid glcolor(black%70) glw(medium) labs(medl)) ///
		xtitle("Authoritarian nostalgia", size(medl)) ///
		xline(0, lcolor(red) lstyle(foreground)) ///
		title("Intereactive model", box fcolor(gs14) bexpand size(medlarge)) ///
		name(inter, replace) ///
		fysize(60) 	
		
graph combine ind inter, xcommon col(1)

graph export "$path/figures/figure4.pdf", replace

*************** Figure 5 ***************

frame change default

preserve

	ttest list_score, by(treatment_list) unequal
	
	gen mean = r(mu_2) - r(mu_1)
	gen lb_95 = mean - invt(r(df_t), 0.025)*r(se)
	gen ub_95 = mean + invt(r(df_t), 0.025)*r(se)
	gen lb_90 = mean - invt(r(df_t),0.05)*r(se)
	gen ub_90 = mean + invt(r(df_t), 0.05)*r(se)		
	gen group="List exp."
	
	
	collapse (first) mean lb_95 ub_95 lb_90 ub_90 group 

	save "$path/temp/diff_in_means_list", replace

restore

preserve

	ci means support_mussolini

	gen mean=r(mean) 
	gen lb_95=r(lb) 
	gen ub_95=r(ub) 

	ci means support_mussolini, level(90)

	gen lb_90=r(lb) 
	gen ub_90=r(ub) 

	gen group="Direct, all"
	
	collapse (first) mean lb_95 ub_95 lb_90 ub_90 group 

	save "$path/temp/diff_in_means_dir_all", replace

restore


use  "$path/temp/diff_in_means_dir_all", replace
append using "$path/temp/diff_in_means_list"


encode group, gen(group_estimate)

recode group_estimate (2=1 "Private (list)") (1=2 "Public (direct)") , gen(group_ordered)
gen value=round(mean*100, .1)
replace lb_95=lb_95*100
replace ub_95=ub_95*100
replace lb_90=lb_90*100
replace ub_90=ub_90*100

	
twoway (bar value group_ordered, barwidth(0.8) color(gs9%70)) ///
	(rspike lb_95 ub_95 group_ordered, lw(thin) lcolor(black%70))  ///
	(rspike lb_90 ub_90 group_ordered, lw(medthick ) lcolor(black%70))  ///
	(rspike lb_95 ub_95 group_ordered, lw(thin) lcolor(black%70))  ///
	(rspike lb_90 ub_90 group_ordered, lw(thin) lcolor(black%70))  ///
	(scatter value group_ordered, msymbol(none) mlabel(value) mlabsize(medlarge) mlabposition(1)) , ///
		xlabel(1(1)2, nogrid valuelabel labsize(medlarge) angle(45)) ///
		xtitle("", size(mlarge)) ///	
		ytitle("Mussolini great statesman", size(mlarge)) ///	
		ylabel(0(10)50, grid glcolor(black%70) glw(thin) labs(medl)) ///
		title("") ///
		legend(off) ///
		aspect(1.5) 
graph export "$path/figures/figure5.pdf", replace


*************** Figure 6 ***************

frames reset
use "$path/data_final.dta", replace

keep if right==1

 frame create output t b se ub95 lb95 ub90 lb90

* Post-commemoration treatment

reg aut_nostalgia i.post_commemoration, vce(robust)
local df=e(df_r)
margins, dydx(post_commemoration) post coeflegend

frame post output (4) (_b[1.post_commemoration]) (_se[1.post_commemoration]) (_b[1.post_commemoration]-invttail(`df', .975)*_se[1.post_commemoration]) (_b[1.post_commemoration]+invttail(`df', .975)*_se[1.post_commemoration]) (_b[1.post_commemoration]-invttail(`df', .95)*_se[1.post_commemoration]) (_b[1.post_commemoration]+invttail(`df', .95)*_se[1.post_commemoration])

* Public treatment

reg aut_nostalgia i.treatment_public, vce(robust)
local df=e(df_r)
margins, dydx(treatment_public) post coeflegend

frame post output (3) (_b[1.treatment_public]) (_se[1.treatment_public]) (_b[1.treatment_public]-invttail(`df', .975)*_se[1.treatment_public]) (_b[1.treatment_public]+invttail(`df', .975)*_se[1.treatment_public]) (_b[1.treatment_public]-invttail(`df', .95)*_se[1.treatment_public]) (_b[1.treatment_public]+invttail(`df', .95)*_se[1.treatment_public])

* Interaction effect
gen inter=post_commemoration
replace inter=1 if post_commemoration==0 & treatment_public==1
replace inter=2 if post_commemoration==1 & treatment_public==0
replace inter=3 if post_commemoration==1 & treatment_public==1

reg aut_nostalgia i.inter, vce(robust)
margins inter

local df=e(df_r)

frame post output (2) (_b[1.inter]) (_se[1.inter]) (_b[1.inter]-invttail(`df', .975)*_se[1.inter]) (_b[1.inter]+invttail(`df', .975)*_se[1.inter]) (_b[1.inter]-invttail(`df', .95)*_se[1.inter]) (_b[1.inter]+invttail(`df', .95)*_se[1.inter])

frame post output (1) (_b[2.inter]) (_se[2.inter]) (_b[2.inter]-invttail(`df', .975)*_se[2.inter]) (_b[2.inter]+invttail(`df', .975)*_se[2.inter]) (_b[2.inter]-invttail(`df', .95)*_se[2.inter]) (_b[2.inter]+invttail(`df', .95)*_se[2.inter])

frame post output (0) (_b[3.inter]) (_se[3.inter]) (_b[3.inter]-invttail(`df', .975)*_se[3.inter]) (_b[3.inter]+invttail(`df', .975)*_se[3.inter]) (_b[3.inter]-invttail(`df', .95)*_se[3.inter]) (_b[3.inter]+invttail(`df', .95)*_se[3.inter])

* Effects plot

frame change output

label define t_lbl 4 "Post-commemoration" 3 "Public treatment" 2 "Public - Pre-commemoration" 1 "Private - Post-commemoration"  0 "Public - Post-commemoration"
label values t t_lbl

twoway ///
	scatter t b if t>2, ///
		mc(black) ///
		msymbol(o) ///
	|| ///
	rspike lb90 ub90 t if t>2, ///
		horizontal ///
		lc(black) ///
		lw(medium) ///
	|| ///
	rspike lb95 ub95 t if t>2, ///
		horizontal ///
		lc(black) ///
		lw(thin) ///
	|| ///
		, ///
		legend(off) ///	
		graphregion(margin(16.85 3.2 0 0)) ///
		ytitle("", size(mlarge)) ///	
		ylabel(3(1)4, valuelabel nogrid labs(medl)) ///
		yscale(range(2.5 4.5)) ///
		xlabel(-8(4)8, grid glcolor(black%70) glw(medium) labs(medl)) ///
		xscale(off) ///
		xtitle("", size(medl)) ///
		xline(0, lcolor(red) lstyle(foreground)) ///
		title("Individual treatment models", box fcolor(gs14) bexpand size(medlarge)) ///
		name(ind, replace) ///
		fysize(50) 
		
twoway ///
	scatter t b if t<=2, ///
		mc(black) ///
		msymbol(o) ///
	|| ///
	rspike lb90 ub90 t if t<=2, ///
		horizontal ///
		lc(black) ///
		lw(medium) ///
	|| ///
	rspike lb95 ub95 t if t<=2, ///
		horizontal ///
		lc(black) ///
		lw(thin) ///
	|| ///
		, ///
		legend(off) ///		
		ytitle("", size(mlarge)) ///	
		ylabel(0(1)2, valuelabel nogrid labs(medl)) ///
		yscale(range(-.5 2.5)) ///
		xlabel(-8(4)8, grid glcolor(black%70) glw(medium) labs(medl)) ///
		xtitle("Authoritarian nostalgia", size(medl)) ///
		xline(0, lcolor(red) lstyle(foreground)) ///
		title("Intereactive model", box fcolor(gs14) bexpand size(medlarge)) ///
		name(inter, replace) ///
		fysize(60) 

graph combine ind inter, xcommon col(1)

graph export "$path/figures/figure6.pdf", replace

*************** Figure 7 ***************

frame change default

preserve

	ttest list_score, by(treatment_list) unequal
	
	gen mean = r(mu_2) - r(mu_1)
	gen lb_95 = mean - invt(r(df_t), 0.025)*r(se)
	gen ub_95 = mean + invt(r(df_t), 0.025)*r(se)
	gen lb_90 = mean - invt(r(df_t),0.05)*r(se)
	gen ub_90 = mean + invt(r(df_t), 0.05)*r(se)		
	gen group="List exp."
	
	
	collapse (first) mean lb_95 ub_95 lb_90 ub_90 group 

	save "$path/temp/diff_in_means_list_rw", replace

restore

preserve

	ci means support_mussolini

	gen mean=r(mean) 
	gen lb_95=r(lb) 
	gen ub_95=r(ub) 

	ci means support_mussolini, level(90)

	gen lb_90=r(lb) 
	gen ub_90=r(ub) 

	gen group="Direct, all"
	
	collapse (first) mean lb_95 ub_95 lb_90 ub_90 group 

	save "$path/temp/diff_in_means_dir_all_rw", replace

restore


use  "$path/temp/diff_in_means_dir_all_rw", replace
append using "$path/temp/diff_in_means_list_rw"


encode group, gen(group_estimate)

recode group_estimate (2=1 "Private (list)") (1=2 "Public (direct)") , gen(group_ordered)
gen value=round(mean*100, .1)
replace lb_95=lb_95*100
replace ub_95=ub_95*100
replace lb_90=lb_90*100
replace ub_90=ub_90*100

	
twoway (bar value group_ordered, barwidth(0.8) color(gs9%70)) ///
	(rspike lb_95 ub_95 group_ordered, lw(thin) lcolor(black%70))  ///
	(rspike lb_90 ub_90 group_ordered, lw(medthick ) lcolor(black%70))  ///
	(rspike lb_95 ub_95 group_ordered, lw(thin) lcolor(black%70))  ///
	(rspike lb_90 ub_90 group_ordered, lw(thin) lcolor(black%70))  ///
	(scatter value group_ordered, msymbol(none) mlabel(value) mlabsize(medlarge) mlabposition(1)) , ///
		xlabel(1(1)2, nogrid valuelabel labsize(medlarge) angle(45)) ///
		xtitle("", size(mlarge)) ///	
		ytitle("Mussolini great statesman", size(mlarge)) ///	
		ylabel(0(10)50, grid glcolor(black%70) glw(thin) labs(medl)) ///
		title("") ///
		legend(off) ///
		aspect(1.5) 
graph export "$path/figures/figure7.pdf", replace
	
*************** Figure 8a and 8b ***************

use "$path/data_final.dta", replace


sum normative_exp, d
local media=r(mean)
local mediana=r(p50)
histogram normative_exp, ///
	bin(15) ///
	color(gs8%40) ///
	percent ///
	xline(`media', ///
		lcolor(red%60)) ///
	xline(`mediana', ///
		lcolor(blue%60)) ///
	xline(50, lcolor(grey) lstyle(foreground)) ///
	name(hist, replace) ///
	xtitle("Normative expectations", size(large)) ///	
	ytitle("Percentage", size(large)) ///	
	aspect(.5)
		
	
graph export "$path/figures/figure8a.pdf", replace


sum empirical_exp, d
local media=r(mean)
local mediana=r(p50)
histogram empirical_exp, ///
	bin(15) ///
	color(gs8%40) ///
	percent ///
	xline(`media', ///
		lcolor(red%60)) ///
	xline(`mediana', ///
		lcolor(blue%60)) ///
	xline(50, lcolor(grey) lstyle(foreground)) ///
	name(hist, replace) ///
	xtitle("Empirical expectations", size(large)) ///	
	ytitle("Percentage", size(large)) ///	
	aspect(.5)

graph export "$path/figures/figure8b.pdf", replace

*************** Figure 9 ***************

sum partisan_commemoration, d
local media=r(mean)
local mediana=r(p50)
histogram partisan_commemoration, ///
	bin(15) ///
	color(gs8%40) ///
	percent ///
	xline(`media', ///
		lcolor(red%60)) ///
	xline(`mediana', ///
		lcolor(blue%60)) ///
	xline(50, lcolor(grey) lstyle(foreground)) ///
	name(hist, replace) ///
	ytitle("Percentage", size(large)) ///	
	xtitle("Partisan commemoration", size(large)) ///
	aspect(.5)

graph export "$path/figures/figure9.pdf", replace


